﻿<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/Site.Master" CodeBehind="SubjectSearchResults.aspx.vb" Inherits="CommunityWebsiteProject.SearchResults" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <p>
        Enter Subject:&nbsp;&nbsp;&nbsp;
        <asp:TextBox ID="tb_SubjectSearch" runat="server" Width="180px"></asp:TextBox>
&nbsp;&nbsp;&nbsp;
        <asp:Button ID="Button1" runat="server" Text="Search" />
        <br />
        <asp:ListView ID="lv_SubjectSearchResults" runat="server" 
            DataSourceID="SqlDataSourceSubjectSearchResults" GroupItemCount="3">
            <AlternatingItemTemplate>
                <td runat="server" style="">
               
                    <a href='Profile.aspx?TutorUserName=<%# Eval("TutorUserName") %>'>
                    <image src= '<%# Eval("Picture") %>'/><a />
                <a />
                    <br />
                    <%# Eval("Title") %> <%# Eval("FirstName") %> <%# Eval("LastName") %>
                    <br />
                     PostCode:<a href='https://maps.google.co.uk/maps?q=<%# Eval("PostCode") %>'><%# Eval("PostCode") %></a><a /><br />Subject:    <%# Eval("Subject") %>
                    <br />
                    HourlyRate: £<%# Eval("HourlyRate") %><br />Availability:   <%# Eval("Availability") %>
                    <br />
                    Tutor User Name:    <%# Eval("TutorUserName")%>
                    <br />
                    <a href='Profile.aspx?TutorUserName=<%# Eval("TutorUserName") %>'>View full profile<a />
                </td>
            </AlternatingItemTemplate>
            <EditItemTemplate>
                <td runat="server" style="">
                    Title:
                    <asp:TextBox ID="TitleTextBox" runat="server" Text='<%# Bind("Title") %>' />
                    <br />FirstName:
                    <asp:TextBox ID="FirstNameTextBox" runat="server" 
                        Text='<%# Bind("FirstName") %>' />
                    <br />LastName:
                    <asp:TextBox ID="LastNameTextBox" runat="server" 
                        Text='<%# Bind("LastName") %>' />
                    <br />Picture:
                    <asp:TextBox ID="PictureTextBox" runat="server" Text='<%# Bind("Picture") %>' />
                    <br />PostCode:
                    <asp:TextBox ID="PostCodeTextBox" runat="server" 
                        Text='<%# Bind("PostCode") %>' />
                    <br />Subject:
                    <asp:TextBox ID="SubjectTextBox" runat="server" Text='<%# Bind("Subject") %>' />
                    <br />HourlyRate:
                    <asp:TextBox ID="HourlyRateTextBox" runat="server" 
                        Text='<%# Bind("HourlyRate") %>' />
                    <br />Availability:
                    <asp:TextBox ID="AvailabilityTextBox" runat="server" 
                        Text='<%# Bind("Availability") %>' />
                    <br />
                    <asp:Button ID="UpdateButton" runat="server" CommandName="Update" 
                        Text="Update" />
                    <br />
                    <asp:Button ID="CancelButton" runat="server" CommandName="Cancel" 
                        Text="Cancel" />
                    <br />
                </td>
            </EditItemTemplate>
            <EmptyDataTemplate>
                <table runat="server" style="">
                    <tr>
                        <td>
                            No data was returned.</td>
                    </tr>
                </table>
            </EmptyDataTemplate>
            <EmptyItemTemplate>
<td runat="server" />
            </EmptyItemTemplate>
            <GroupTemplate>
                <tr ID="itemPlaceholderContainer" runat="server">
                    <td ID="itemPlaceholder" runat="server">
                    </td>
                </tr>
            </GroupTemplate>
            <InsertItemTemplate>
                <td runat="server" style="">
                    Title:
                    <asp:TextBox ID="TitleTextBox" runat="server" Text='<%# Bind("Title") %>' />
                    <br />FirstName:
                    <asp:TextBox ID="FirstNameTextBox" runat="server" 
                        Text='<%# Bind("FirstName") %>' />
                    <br />LastName:
                    <asp:TextBox ID="LastNameTextBox" runat="server" 
                        Text='<%# Bind("LastName") %>' />
                    <br />Picture:
                    <asp:TextBox ID="PictureTextBox" runat="server" Text='<%# Bind("Picture") %>' />
                    <br />PostCode:
                    <asp:TextBox ID="PostCodeTextBox" runat="server" 
                        Text='<%# Bind("PostCode") %>' />
                    <br />Subject:
                    <asp:TextBox ID="SubjectTextBox" runat="server" Text='<%# Bind("Subject") %>' />
                    <br />HourlyRate:
                    <asp:TextBox ID="HourlyRateTextBox" runat="server" 
                        Text='<%# Bind("HourlyRate") %>' />
                    <br />Availability:
                    <asp:TextBox ID="AvailabilityTextBox" runat="server" 
                        Text='<%# Bind("Availability") %>' />
                    <br />
                    <asp:Button ID="InsertButton" runat="server" CommandName="Insert" 
                        Text="Insert" />
                    <br />
                    <asp:Button ID="CancelButton" runat="server" CommandName="Cancel" 
                        Text="Clear" />
                    <br />
                </td>
            </InsertItemTemplate>
            <ItemTemplate>
                <td runat="server" style="">
                 <a href='Profile.aspx?TutorUserName=<%# Eval("TutorUserName") %>'>
                    <image src= '<%# Eval("Picture") %>'/><a />   
                <a />
                    <br />
                    <%# Eval("Title") %> <%# Eval("FirstName") %> <%# Eval("LastName") %>
                    <br />
                     PostCode:<a href='https://maps.google.co.uk/maps?q=<%# Eval("PostCode") %>'><%# Eval("PostCode") %></a><a /><br />Subject:    <%# Eval("Subject") %>
                    <br />
                    HourlyRate: £<%# Eval("HourlyRate") %><br />Availability:   <%# Eval("Availability") %>
                    <br />
                    Tutor User Name:    <%# Eval("TutorUserName")%>
                    <br />
                    <a href='Profile.aspx?TutorUserName=<%# Eval("TutorUserName") %>'>View full profile<a />
                </td>
            </ItemTemplate>
            <LayoutTemplate>
                <table runat="server">
                    <tr runat="server">
                        <td runat="server">
                            <table ID="groupPlaceholderContainer" runat="server" border="0" style="">
                                <tr ID="groupPlaceholder" runat="server">
                                </tr>
                            </table>
                        </td>
                    </tr>
                    <tr runat="server">
                        <td runat="server" style="">
                        </td>
                    </tr>
                </table>
            </LayoutTemplate>
            <SelectedItemTemplate>
                <td runat="server" style="">
                    Title:
                    <asp:Label ID="TitleLabel" runat="server" Text='<%# Eval("Title") %>' />
                    <br />FirstName:
                    <asp:Label ID="FirstNameLabel" runat="server" Text='<%# Eval("FirstName") %>' />
                    <br />LastName:
                    <asp:Label ID="LastNameLabel" runat="server" Text='<%# Eval("LastName") %>' />
                    <br />Picture:
                    <asp:Label ID="PictureLabel" runat="server" Text='<%# Eval("Picture") %>' />
                    <br />PostCode:
                    <asp:Label ID="PostCodeLabel" runat="server" Text='<%# Eval("PostCode") %>' />
                    <br />Subject:
                    <asp:Label ID="SubjectLabel" runat="server" Text='<%# Eval("Subject") %>' />
                    <br />HourlyRate:
                    <asp:Label ID="HourlyRateLabel" runat="server" 
                        Text='<%# Eval("HourlyRate") %>' />
                    <br />Availability:
                    <asp:Label ID="AvailabilityLabel" runat="server" 
                        Text='<%# Eval("Availability") %>' />
                    <br />
                </td>
            </SelectedItemTemplate>
        </asp:ListView>
        <asp:SqlDataSource ID="SqlDataSourceSubjectSearchResults" runat="server" 
            ConnectionString="<%$ ConnectionStrings:TutorsConnectionString %>" 
            ProviderName="<%$ ConnectionStrings:TutorsConnectionString.ProviderName %>" 
            
            
            SelectCommand="SELECT [PostCode], [Subject], [HourlyRate], [Availability], [TutorUserName], [Picture], [Title], [FirstName], [LastName] FROM [tblTutorProfile] WHERE ([Subject] = ?)">
            <SelectParameters>
                <asp:ControlParameter ControlID="tb_SubjectSearch" Name="Subject" 
                    PropertyName="Text" Type="String" />
            </SelectParameters>
        </asp:SqlDataSource>
    </p>
</asp:Content>
